package com.qf.service.impl;

import com.qf.dao.AdminDao;
import com.qf.factory.BeanFactory;
import com.qf.service.AdminService;

/**
 * @Description: 公用常量
 * @Data: 2022/8/26 11:07
 * @Pacakge: com.qf.service.impl
 * @ClassName: AdminServiceImpl
 * @Author: fan
 */
public class AdminServiceImpl implements AdminService {
//   传统方式
//    private AdminDao adminDao = new AdminDaoImpl();
//通过工厂的方式获取对应的bean实例(多例)
    private AdminDao adminDao = (AdminDao) BeanFactory.getBean("adminDao");
//通过工厂的方式获取对应的bean实例(单例)
    private AdminDao adminDaoOne = (AdminDao) BeanFactory.getBeansByOne("adminDao");
    @Override
    public void addAdmin() {
//        adminDao.addAdmin();
        System.out.println(adminDao);
        adminDao.addAdmin();
        System.out.println(adminDaoOne);
        adminDao.addAdmin();
    }
}
